/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.restaurant.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author root
 */
@Entity
@Table(name = "moneytransaction")
@XmlRootElement(name = "moneytransaction")
@NamedQueries({
    @NamedQuery(name = "Moneytransaction.findAll", query = "SELECT m FROM Moneytransaction m"),
    @NamedQuery(name = "Moneytransaction.findByMoneytransactionID", query = "SELECT m FROM Moneytransaction m WHERE m.moneytransactionID = :moneytransactionID"),
    @NamedQuery(name = "Moneytransaction.findByDescription", query = "SELECT m FROM Moneytransaction m WHERE m.description = :description"),
    @NamedQuery(name = "Moneytransaction.findByAmount", query = "SELECT m FROM Moneytransaction m WHERE m.amount = :amount"),
    @NamedQuery(name = "Moneytransaction.findByDatetime", query = "SELECT m FROM Moneytransaction m WHERE m.datetime = :datetime"),
    @NamedQuery(name = "Moneytransaction.findByIsdeleted", query = "SELECT m FROM Moneytransaction m WHERE m.isdeleted = :isdeleted")})
public class Moneytransaction implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "MoneytransactionID")
    private Long moneytransactionID;
    @Column(name = "description")
    private String description;
    @Column(name = "amount")
    private Double amount;
    @Column(name = "datetime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetime;
    @Column(name = "isdeleted")
    private Boolean isdeleted;
    @JoinColumn(name = "transactiontype_TransactiontypeID", referencedColumnName = "TransactiontypeID")
    @ManyToOne(optional = false)
    private Transactiontype transactiontype;
    @JoinColumn(name = "person_PersonID", referencedColumnName = "PersonID")
    @ManyToOne(optional = false)
    private Person person;

    public Moneytransaction() {
    }

    public Moneytransaction(Long moneytransactionID) {
        this.moneytransactionID = moneytransactionID;
    }

    public Long getMoneytransactionID() {
        return moneytransactionID;
    }

    public void setMoneytransactionID(Long moneytransactionID) {
        this.moneytransactionID = moneytransactionID;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Date getDatetime() {
        return datetime;
    }

    public void setDatetime(Date datetime) {
        this.datetime = datetime;
    }

    public Boolean getIsdeleted() {
        return isdeleted;
    }

    public void setIsdeleted(Boolean isdeleted) {
        this.isdeleted = isdeleted;
    }

    public Transactiontype getTransactiontype() {
        return transactiontype;
    }

    public void setTransactiontype(Transactiontype transactiontype) {
        this.transactiontype = transactiontype;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (moneytransactionID != null ? moneytransactionID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Moneytransaction)) {
            return false;
        }
        Moneytransaction other = (Moneytransaction) object;
        if ((this.moneytransactionID == null && other.moneytransactionID != null) || (this.moneytransactionID != null && !this.moneytransactionID.equals(other.moneytransactionID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.restaurant.domain.Moneytransaction[moneytransactionID=" + moneytransactionID + "]";
    }

}
